package com.boot.security.server.dao.mffl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.mffl.MfflCourierServicesOrder;

@Mapper
public interface MfflCourierServicesOrderDao {

    @Select("select * from mffl_courier_services_order t where t.id = #{id}")
    MfflCourierServicesOrder getById(Long id);

    @Delete("delete from mffl_courier_services_order where id = #{id}")
    int delete(Long id);

    int update(MfflCourierServicesOrder mfflCourierServicesOrder);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into mffl_courier_services_order(ielationId, ielationServiceName, ielationtype, Sender, originatingPlace, SenderPhone, courierCompanyId, courierNumber, createTime, updateTime) values(#{ielationId}, #{ielationServiceName}, #{ielationtype}, #{Sender}, #{originatingPlace}, #{SenderPhone}, #{courierCompanyId}, #{courierNumber}, #{createTime}, #{updateTime})")
    int save(MfflCourierServicesOrder mfflCourierServicesOrder);
    
    int count(@Param("params") Map<String, Object> params);

    List<MfflCourierServicesOrder> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);


    /**
     * 查询物流信息
     * @param ielationId
     * @param ielationtype
     * @return
     */
    @Select("select * from mffl_courier_services_order t where t.ielationId = #{ielationId} AND t.ielationtype = #{ielationtype}")
    List<MfflCourierServicesOrder> getByIelationId(@Param("ielationId") Integer ielationId,@Param("ielationtype")Integer ielationtype);
}
